package com.staff.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.institute.entity.Institute;
import com.institute.entity.Position;
import com.salary.entity.SalaryRecord;
import com.salary.entity.Tax;
import com.staff.entity.dto.StaffQueryDTO;
import com.transfer.entity.Expatriate;
import com.transfer.entity.PersonTransfer;
import com.transfer.entity.QuitStaff;
import com.transfer.entity.TitleAppoint;
import com.welfare.entity.WelfareRecord;


@Entity
@Table(name="t_staff")
public class Staff {//员工实体类
	private Long id;
	private String staffNum;
	private String password;
	private String staffName;//非空
	private String sex;
	private String idCard;
	private String phoneNum;
	private String education;
	private String degree;
	private String post;
	private String staffState;
	private String title;
	private String staffType;
	private Date entryDate;
	private Date birthday;
	private String nationality;
	private String address;
	
	private Institute department;
	private Position position;        //关联职务类
	private List<Tax> taxes = new ArrayList();
	private List<WelfareRecord> welfareRecords = new ArrayList();
	private List<SalaryRecord> salaryRecords = new ArrayList();
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	@JsonIgnore
	@OneToMany(cascade=CascadeType.ALL,mappedBy="staff")
	public List<Tax> getTaxes() {
		return taxes;
	}
	@JsonIgnore
	@ManyToMany(cascade=CascadeType.ALL,mappedBy="staffs")
	public List<WelfareRecord> getWelfareRecords() {
		return welfareRecords;
	}
	@JsonIgnore
	@OneToMany(cascade=CascadeType.ALL,mappedBy="staff")
	public List<SalaryRecord> getSalaryRecords() {
		return salaryRecords;
	}
	@JsonIgnore
	@ManyToOne
	public Institute getDepartment() {
		return department;
	}
	@JsonIgnore
	@ManyToOne
	public Position getPosition() {
		return position;
	}
	@Column(unique=true,nullable=false)
	public String getStaffNum() {
		return staffNum;
	}
	public String getPassword() {
		return password;
	}
	public String getStaffName() {
		return staffName;
	}
	public String getSex() {
		return sex;
	}
	public String getIdCard() {
		return idCard;
	}
	public String getPhoneNum() {
		return phoneNum;
	}
	public String getEducation() {
		return education;
	}
	public String getDegree() {
		return degree;
	}
	public String getPost() {
		return post;
	}
	public String getStaffState() {
		return staffState;
	}
	public String getTitle() {
		return title;
	}
	public String getStaffType() {
		return staffType;
	}
	@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss",timezone = "GMT+8")
	public Date getEntryDate() {
		return entryDate;
	}
	@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss",timezone = "GMT+8")
	public Date getBirthday() {
		return birthday;
	}
	public String getNationality() {
		return nationality;
	}
	public String getAddress() {
		return address;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	public void setStaffNum(String staffNum) {
		this.staffNum = staffNum;
	}
	public void setStaffName(String staffName) {
		this.staffName = staffName;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}
	public void setPhoneNum(String phoneNum) {
		this.phoneNum = phoneNum;
	}
	public void setEducation(String education) {
		this.education = education;
	}
	public void setDegree(String degree) {
		this.degree = degree;
	}
	public void setPost(String post) {
		this.post = post;
	}
	public void setStaffState(String staffState) {
		this.staffState = staffState;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public void setStaffType(String staffType) {
		this.staffType = staffType;
	}
	public void setEntryDate(Date entryDate) {
		this.entryDate = entryDate;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public void setNationality(String nationality) {
		this.nationality = nationality;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	public void setTaxes(List<Tax> taxes) {
		this.taxes = taxes;
	}
	public void setWelfareRecords(List<WelfareRecord> welfareRecords) {
		this.welfareRecords = welfareRecords;
	}
	public void setSalaryRecords(List<SalaryRecord> salaryRecords) {
		this.salaryRecords = salaryRecords;
	}
	
	public void setDepartment(Institute department) {
		this.department = department;
	}
	public void setPosition(Position position) {
		this.position = position;
	}
	@Override
	public String toString() {
		return "Staff [id=" + id + ", staffNum=" + staffNum + ", password=" + password + ", staffName=" + staffName
				+ ", sex=" + sex + ", idCard=" + idCard + ", phoneNum=" + phoneNum + ", education=" + education
				+ ", degree=" + degree + ", post=" + post + ", staffState=" + staffState + ", department=" + department
				+ ", position=" + position + ", title=" + title + ", staffType=" + staffType + ", entryDate="
				+ entryDate + ", birthday=" + birthday + ", nationality=" + nationality + ", address=" + address + "]";
	}
	
}
